﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:MedLink2011.Controls">

  <Style TargetType="local:WatermarkedTextBox">
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Background" Value="#FFFFFFFF" />
    <Setter Property="Foreground" Value="#FF000000" />
    <Setter Property="Padding" Value="2" />
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="WatermarkBrush" Value="#FF808080" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:WatermarkedTextBox">
          <Grid x:Name="Root" >
            <Grid.Resources>
              <SolidColorBrush x:Key="Background" Color="#FF003255"/>
              <SolidColorBrush x:Key="BorderBrush" Color="#FF000000"/>
              <SolidColorBrush x:Key="AccentBrush" Color="#FFFFFFFF"/>
              <SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF"/>
              <SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
              <LinearGradientBrush x:Key="FocusedStrokeBrush" StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                <GradientStop Color="#51FFFFFF" Offset="1"/>
                <GradientStop Color="#66FFFFFF" Offset="0.325"/>
                <GradientStop Color="#1EFFFFFF" Offset="0.325"/>
              </LinearGradientBrush>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal" />
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0" />
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="WatermarkStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Unwatermarked" />
                <VisualState x:Name="Watermarked">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                    <DoubleAnimation Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="FocusStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0" />
                  <VisualTransition To="Focused" GeneratedDuration="0:0:0.1" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Unfocused" />
                <VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                    <DoubleAnimation Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                    <DoubleAnimation Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Opacity="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
              <Grid>
                <Border x:Name="ReadOnlyVisualElement" Background="#72F7F7F7" Opacity="0" />
                <Border x:Name="MouseOverBorder" BorderThickness="1" BorderBrush="Transparent">
                  <ScrollViewer x:Name="ContentElement" Padding="{TemplateBinding Padding}" BorderThickness="0" IsTabStop="False"/>
                </Border>
                <ContentControl x:Name="Watermark"
                  Opacity="0" IsTabStop="False" IsHitTestVisible="False"
                  Content="{TemplateBinding WatermarkContent}"
                  Foreground="{StaticResource WatermarkBrush}"
                  Background="{TemplateBinding Background}"
                  FontFamily="{TemplateBinding FontFamily}"
                  FontSize="{TemplateBinding FontSize}"
                  FontStretch="{TemplateBinding FontStretch}"
                  FontStyle="{TemplateBinding FontStyle}"
                  FontWeight="{TemplateBinding FontWeight}"
                  Padding="{TemplateBinding Padding}"
                  Margin="0,0,0,0"/>
              </Grid>
            </Border>
            <Border x:Name="DisabledVisualElement" Background="#A5F7F7F7" BorderBrush="#A5F7F7F7" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" IsHitTestVisible="False"/>
            <Border x:Name="FocusVisualElement" BorderBrush="#FF6DBDD1" BorderThickness="{TemplateBinding BorderThickness}" Margin="1" Opacity="0" IsHitTestVisible="False"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>
